<%--
  Created by IntelliJ IDEA.
  User: YYY-Work
  Date: 2017/5/25
  Time: 14:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path;
%>
<!DOCTYPE>
<html>
<head>
    <title>Title</title>
    <meta charset="UTF-8">
    <title>AdminLTE | Data Tables</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>

    <!-- start分页需要使用以下三个js -->
    <script type="text/javascript" src="<%=basePath%>/js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/admin/utils.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/base/listtable.js"></script>
    <!-- end分页需要使用以上三个js -->


    <style>
        .table th, .table td {
            text-align: center;
            vertical-align: middle !important;
        }
    </style>
</head>
<body class="skin-blue">
<!-- getHeader -->
<s:action name="getHeader" namespace="/privilege" executeResult="true"/>
<div class="wrapper row-offcanvas row-offcanvas-left">
    <!-- Left side column. contains the logo and sidebar -->

    <!-- getMenus -->
    <s:action name="getMenus" namespace="/privilege" executeResult="true"/>

    <!-- Right side column. Contains the navbar and content of the page -->
    <aside class="right-side">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <small>提现申请管理</small>
            </h1>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">

                        <div class="box box-danger">

                            <div class="box-body">
                                <a href="<%=basePath%>/bill/ajaxOneKeyForCash.action">
                                    <button type="button" class="btn btn-success">一键提现申请</button>
                                </a>

                            </div><!-- /.box-body -->
                        </div><!-- /.box -->
                        <!-- 提现申请列表 -->
                        <form method="post" target="_self" action="" name="listForm">
                            <div class="box-body table-responsive" id="listDiv">

                                <s:property value="res" escape="false"/>
                            </div><!-- /.box-body -->
                        </form>

                    </div><!-- /.box -->


                </div>
            </div>

        </section><!-- /.content -->
    </aside><!-- /.right-side -->
</div><!-- ./wrapper -->

</body>

<script type="text/javascript">

    function searchVoucherBill() {
        listTable.filter['currentPage']=1;
        listTable.filter['runFlag']=0;
        listTable.action = "<%=basePath%>/bill/ajaxQueryUserAccountVoucherBill.action";
        listTable.loadList();
    }


    function agreeVoucherBill(ss) {
        var userid=$(ss).attr("user-id");
        $.ajax({
            type: "POST",
            url: '<%=basePath%>/bill/ajaxAgreeUserAccountVoucherBill.action?userid='+userid,
            cache: false,
            dataType: 'json',
            success: agreesuccessfun,
            error:errorfun
        });
    }


    function refusedVoucherBill(ss) {
        var userid=$(ss).attr("user-id");
        $.ajax({
            type: "POST",
            url: '<%=basePath%>/bill/ajaxRefusedUserAccountVoucherBill.action?userid='+userid,
            cache: false,
            dataType: 'json',
            success: refusedsuccessfun,
            error:errorfun
        });
    }

    function agreesuccessfun(data) {
        if (data.errorCode >= 0) {
            alert("确认成功");
        }else
        {
            alert(data.errorMsg);
        }
    }

    function refusedsuccessfun(data) {
        if (data.errorCode >= 0) {
            alert("拒绝成功");
        }else
        {
            alert(data.errorMsg);
        }
    }

    function errorfun() {
        alert("error");
    }

    $(document).ready(new function () {
        searchVoucherBill();
    })


</script>
</html>
